<?php
class Merchant_Model_Validate_CueValidate extends Merchant_Model_Validate_CommonValidate
{

	//收件人城市
	public function consigneeCity(){
        $regex = array('name' => '收件人城市','value' => $this->consignee_city,'regex' => array('length[1,255]','noCharacter','require'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//收件人州
	public function consigneeRegion(){
		$regex = array('name' => '收件人州/区域','value' => $this->consignee_region,'regex' => array('length[1,128]','noCharacter'));
        //日本,美国,澳大利亚，加拿大
        $countryIdArr = array(41,253,13,118);
        if(in_array($this->consignee_country_id,$countryIdArr)){
            $regex['regex'][] = "require";
        }
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//电话
	public function consigneePhone(){
 		$regex = array('name' =>  '电话号码','value' => $this->consignee_phone,'regex' => array('length[1,30]','noCharacter','require'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//邮编
	public function consigneeZip(){
		$regex = array('name' => '邮政编号','value' => $this->consignee_zip,'regex' =>  array('length[1,255]','noCharacter','require'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	
    public function validator(){
		$this->PublicValidator();
        return $this->_error;
    }
}